package com.mindbook.vip.gawxchatinfo.controller.nostrum;

import com.mindbook.vip.gawxchatinfo.entity.nostrum.PrimaryLiverCancerTreatment;
import com.mindbook.vip.gawxchatinfo.entity.user.UserFront;
import com.mindbook.vip.gawxchatinfo.service.nostrum.PrimaryLiverCancerTreatmentService;
import com.mindbook.vip.gawxchatinfo.utils.result.Result;
import com.mindbook.vip.gawxchatinfo.utils.result.ResultUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @NAME: wxb
 * @DATE: 2022/8/7
 * @DESCRIPTION:
 **/
@Api("原发性肝癌治疗方案选择")
@RestController
@RequestMapping("primaryLiverCancerTreatment")
public class PrimaryLiverCancerTreatmentController {

    @Autowired private PrimaryLiverCancerTreatmentService service;


    @ApiOperation("业务处理")
    @PostMapping("/")
    public Result businessProcess(PrimaryLiverCancerTreatment p, BindingResult bindingResult){

        String groupName = service.businessProcess(p);

        //将用户操作数据进行保存
        p.setGroupName(groupName);
        UserFront user = (UserFront) SecurityUtils.getSubject().getPrincipal();
        p.setUserId(user.getId());
        service.addSelective(p);

        return ResultUtils.genSuccessResult(groupName);
    }

}
